package cn.com.open.itembank.common;

import cn.com.open.itembank.dto.DifficultyRangeModel;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by lucky on 2017/7/17.
 */
public class GlobalConst {

    public GlobalConst() {

    }

    /**
     * The constant EMPTYUUID.
     */
    public static final String EMPTYUUID = "00000000-0000-0000-0000-000000000000";
    /**
     * The constant EMPTYID.
     */
    public static final String EMPTYID = "00000000000000000000000000000000";

    //region 错误码定义

    /**
     * 正常
     */
    public static final int SUCCESS = 0;
    /**
     * 数据库操作错误
     */
    public static final int DATA_BASE_ERROR = -100;
    /**
     * 其他错误
     */
    public static final int OTHER_ERROR = -199;
    /**
     * 系统不支持此操作
     */
    public static final int NOT_SUPPORT = -200;
    /**
     * 数据不完整
     */
    public static final int INCOMPLETE_DATA = -201;
    /**
     * 数据格式错误
     */
    public static final int DATA_FORMAT_ERROR = -202;
    /**
     * 数据获取失败
     */
    public static final int DATA_GETTING_FAIL = -203;
    /**
     * 文件类型错误
     */
    public static int FILE_TYPE_ERROR = -204;
    /**
     * 文件格式错误
     */
    public static int FILE_FORMAT_ERROR = -205;
    /**
     * 其他数据已存在
     */
    public static final int DATA_EXIST = -209;
    /**
     * 试题ID存在
     */
    public static final int QUESTION_EXIST = -210;
    /**
     * 试卷ID存在
     */
    public static final int PAPER_EXIST = -211;
    /**
     * 试题ID不存在
     */
    public static int QUESTION_NOT_EXIST = -212;
    /**
     * 大题不存在
     */
    public static int SECTION_NOT_EXIST = -213;
    /**
     * 试卷ID不存在
     */
    public static int PAPER_NOT_EXIST = -214;
    /**
     * 标识符不存在
     */
    public static final int ID_NOT_EXIST = -215;
    /**
     * 课程已经存在
     */
    public static final int COURSE_EXIST = -216;
    /**
     * 课程（题库）不存在
     */
    public static final int ITEM_BANK_NOT_EXIST = -217;
    /**
     * 试题试卷的课程ID不匹配
     */
    public static final int PAPER_QUESTION_COURSE_NOT_COMPARE = -220;
    /**
     * 不支持的题型
     */
    public static final int IS_NOT_SUPPORTED_INNER_TYPE = -232;
    /**
     * 序列号已存在
     */
    public static final int SERIAL_NUMBER_EXIST = -233;
    /**
     * 试题题干为空 
     */
    public static int ITEM_TITLE_EMPTY = -300;
    /**
     * 试题选项为空 
     */
    public static int ITEM_CHOICE_EMPTY = -310;
    /**
     * 选项答案个数不匹配 
     */
    public static int CHOICE_ANSWER_NOT_MATCH = -311;
    /**
     * 答案分数不匹配 
     */
    public static int ANSWER_SCORE_NOT_MATCH = -312;
    /**
     * 单空答案分数不匹配 
     */
    public static int ANSWER_SCORE_NOT_MATCH_IN_ONE_PLACE = -313;
    /**
     * 题干个数和答案个数不匹配 
     */
    public static int PROMPT_ANSWER_NOT_MATCH = -314;
    /**
     * 子试题个数不匹配 
     */
    public static int SUB_COUNT_NOT_MATCH = -315;
    /**
     * 试题答案为空 
     */
    public static int ITEM_ANSWER_EMPTY = -320;
    /**
     * 试题答案不唯一 
     */
    public static int CHOICE_ANSWER_NOT_ONLY = -321;
    /**
     * 正确答案无法转换为数字 
     */
    public static int ANSWER_NOT_CONVERT_TO_NUMBER = -322;
    /**
     * 正确答案标识超过答案数量 
     */
    public static int ANSWER_INDEX_NOT_IN_CHOICES = -323;
    /**
     * 正确答案标识分值超出范围 
     */
    public static int SCORE_OUT_OF_RANGE = -324;
    /**
     * 限制字符长度小于0 
     */
    public static int LENGTH_LESS_THEN_ZERO = -325;
    /**
     * 选项标识重复 
     */
    public static int OPTIONID_REPEAT = -330;
    /**
     * 选项文字重复 
     */
    public static int OPTIONCONTENT_REPEAT = -331;
    /**
     * 正确答案选项为空 
     */
    public static int OPTION_HAS_NO_CORRECT = -332;
    /**
     * 查无此选项 
     */
    public static int OPTION_NOTEXIST = -333;
    /**
     * 选项为唯一正确答案 
     */
    public static int OPTION_IS_ONLY_ANSWER = -334;
    /**
     * 子试题唯一 
     */
    public static int SUB_IS_ONLY = -335;
    /**
     * 子试题分数不匹配 
     */
    public static int SUBITEMSCORE_NOT_STANDARD = -336;
    /**
     * 媒体定义不在允许范围 
     */
    public static int MEDIADEFINITION_NOT_ALLOWED = -337;
    /**
     * 媒体时长不在允许范围
     */
    public static int MEDIALENGTH_NOT_ALLOWED = -338;
    /**
     * 课程不存在 
     */
    public static final int COURSE_NOT_EXIST = -401;
    /**
     * 试卷标题为空 
     */
    public static final int PAPER_NAME_EMPTY = -402;
    /**
     * 资源不存在
     */
    public static int RESOURCE_NOT_EXIST = -404;
    /**
     * 试题无题库
     */
    public static final int NO_ITEM_BANK = -405;
    /**
     * 试题与题库不匹配
     */
    public static final int QUESTION_ITEM_BANK_NOT_MATCH = -406;
    /**
     * 试题非私有
     */
    public static final int NO_PRIVATE = -407;
    /**
     * 无权限
     */
    public static final int NO_PERMISSION = -408;

    //endregion

    /**
     * 三个值的难度系数范围设定.
     *
     * @return the big diff range
     */
    public List<DifficultyRangeModel> getBigDiffRange() {
        List<DifficultyRangeModel> bigDiffRange = new ArrayList<>();

        bigDiffRange.add(new DifficultyRangeModel("Hard", 0.0, 0.3));
        bigDiffRange.add(new DifficultyRangeModel("Normal", 0.4, 0.6));
        bigDiffRange.add(new DifficultyRangeModel("Easy", 0.7, 1.0));

        return bigDiffRange;
    }
}
